package com.bjsxt.controller;

import com.bjsxt.pojo.PageA;
import com.bjsxt.pojo.Role;
import com.bjsxt.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("/findAllRoleLer")
    public PageA<Role> findAllRoleLer(Integer page,Integer rows){
        return roleService.findAllRole(page, rows);
    }

    @RequestMapping("/addRoleLer")
    public Integer addRoleLer(Role role,Integer[] mids){
        return roleService.addRole(role,mids);
    }

    @RequestMapping("/findmidLer")
    public List<Integer> findmidLer(Integer rid){
        return roleService.findmid(rid);
    }

    @RequestMapping("/changeRoleLer")
    public Integer changeRoleLer(Role role,Integer[] mids){
        return roleService.changeRole(role, mids);
    }
}
